package com.ahm.server.controller;

import com.ahm.server.common.RespBean;
import com.ahm.server.dto.AdminLoginParam;
import com.ahm.server.service.IAdminService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * @author anhaimeng
 * @title: LoginController
 * @projectName yeb001
 * @description: TODO
 * @date 2021/9/2219:27
 */
/*功能描述
 * @author ahm
 */
@Api(tags = "登录模块")
@RestController
public class LoginController {

    @Autowired
    private IAdminService iAdminService;
    /**
    　　* @description: 登录
    　　* @param 登录信息
    　　* @return RespBean
    　　* @throws
    　　* @author anhaimeng
    　　* @date 2021/9/23 11:24
    　　*/
    @ApiOperation(value = "登录之后返回token")
    @PostMapping("/login")
    public RespBean login(@RequestBody AdminLoginParam adminLoginParam,HttpServletRequest request) {
        return iAdminService.login(adminLoginParam.getUsername(),adminLoginParam.getPassword(),adminLoginParam.getCode(),request);
    }


}
